<article id="wikiArticle">
<div></div>
<h2 id="信息">信息</h2>
<pre><code class="language-javascript">SyntaxError: missing ] after element list
</code></pre>
<h2 id="错误类型">错误类型</h2>
<p><a href="Reference/Global_Objects/SyntaxError" title="SyntaxError 对象代表尝试解析语法上不合法的代码的错误。"><code>SyntaxError</code></a>.</p>
<h2 id="哪里出错了">哪里出错了?</h2>
<p>数组初始化在某处出现了语法错误。比如缺少了右中括号("<code>]</code>") 或一个逗号 ("<code>,</code>")。</p>
<h2 id="示例">示例</h2>
<h3 id="不正确的数组初始化">不正确的数组初始化</h3>
<pre><code class="language-js example-bad">var list = [1, 2,

var instruments = [
  "Ukulele",
  "Guitar",
  "Piano"
};

var data = [{foo: "bar"} {bar: "foo"}];
</code></pre>
<p>正确的是：</p>
<pre><code class="language-js example-good">var list = [1, 2];

var instruments = [
 "Ukulele",
 "Guitar",
 "Piano"
]; 

var data = [{foo: "bar"}, {bar: "foo"}];</code></pre>
<h2 id="相关">相关</h2>
<ul>
<li><a href="Reference/Array" title="REDIRECT Array"><code>Array</code></a></li>
</ul>
</article>